/* 
 * cms, 一个基于J2EE架构内容管理系统
 * Copyright © GrayRabbit Co., Ltd. All rights reserved.
 * Department : 运营部
 * 更多信息,请访问:
 * http://code.google.com/p/gray-rabbit-cms/
 */
package org.grayrabbit.cms.action.common;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.grayrabbit.cms.constant.ConstantWebApp;
import org.grayrabbit.cms.entity.Admin;
import org.grayrabbit.cms.entity.Site;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;


/**
 * <b>DashboardAction</b> Struts2 action类
 * 
 * 
 */
@Controller
@Scope("prototype")
@Namespace("/")
public class DashboardAction extends SimpleAction {
	private static final long serialVersionUID = 4514755065358868911L;

	private Admin admin;
	private Site site;
	private boolean flag=false;
	private boolean leftFlag=false;
	private String siteHtml;

	@Override
	@Action(value = "dashboard")
	public String execute() {
		
		return SUCCESS;
	}

	@Action(value = "lefttree")
	public String leftTree() {
		if(site!=null && StringUtils.isNotBlank(site.getSiteId())){
			leftFlag=true;
		}
		return SUCCESS;
	}

	@Action(value = "header")
	public String head() {
		return SUCCESS;
	}

	@Action(value = "main")
	public String main() { 
		return SUCCESS;
	}
	
	@Action(value = "go") 
	public String go(){
		initPageLeftTreeFlag();
		return SUCCESS;
	}
	
	@Action(value = "mainpage") 
	public String mainpage(){
		return SUCCESS;
	}

	private void initPageLeftTreeFlag(){
		if(site!=null && StringUtils.isNotBlank(site.getSiteId())){
			setSessionValue(ConstantWebApp.CURRENT_SITE, site);
		}
	}
	
	
	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}


	public Site getSite() {
		return site;
	}

	public void setSite(Site site) {
		this.site = site;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public boolean isLeftFlag() {
		return leftFlag;
	}

	public void setLeftFlag(boolean leftFlag) {
		this.leftFlag = leftFlag;
	}

	public String getSiteHtml() {
		return siteHtml;
	}

	public void setSiteHtml(String siteHtml) {
		this.siteHtml = siteHtml;
	}

 
}
